﻿#region

using System;
using System.Web;
using BusinessLogicLayer;

#endregion

namespace FastTrackCabService
{
    public class Global : HttpApplication
    {
        protected void Application_Start(object sender, EventArgs e)
        {
        }

        protected void Session_Start(object sender, EventArgs e)
        {
        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {
        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {
        }

        protected void Application_Error(object sender, EventArgs e)
        {
            var ex = Server.GetLastError();

            var httpException = ex as HttpException;

            if (ex != null)
            {
                ExceptionLogBLL.Log(ex);
                Server.ClearError();

                if (httpException != null && httpException.GetHttpCode() == 404)
                {
                    Response.Redirect("~/InvalidLink.aspx");
                }

                Response.Redirect("~/ErrorMessage.aspx");
            }
        }

        protected void Session_End(object sender, EventArgs e)
        {
        }

        protected void Application_End(object sender, EventArgs e)
        {
        }
    }
}